package demo.spark.utils

import org.apache.spark.{SparkConf, SparkContext}

object SparkCore {

  implicit var master : String = "local[*]";

  def getContext(appName:String = "App") (implicit master:String = master): SparkContext = {
    //创建基于local环境的spark上下文配置.
    var conf: SparkConf = new SparkConf()
      .setAppName(appName)
      .setMaster(master);
    //创建spark上下文.
    var sparkContext: SparkContext = new SparkContext(conf);
    sparkContext;
  }

}
